<%@ include file="/decorator/taglibs.jsp"%>
<c:url var="url" value="/user/save.htm" />
<c:url var="check" value="/user/check.htm" />
<head>
<title>Edit User</title>
<script type="text/javascript" src="<c:url value='/jquery/jquery.validate.js'/>"></script>
<script>
$(function() {
	init();
	$("#userform").validate({
		 rules: {
		 email: { required: true, remote: "${check}"},
		 firstName: { required: true},
		 lastName: { required: true}
	 },
		 messages: {
		 email: {remote: jQuery.validator.format("{0} has already registered, please choose another one.")}
	 }}
);
	});
</script>
</head>

<hr/>
<div class="span-24">
<form:form action="${url}" commandName="user" id="userform">
<fieldset>
      <legend>
	<c:if test="${ empty user.username}">User Register</c:if>	
      	</legend>

	<p><label>Email</label><br/><form:input path="email" cssClass="title email" id="email"/></p>
	<p><label>Password</label><br/><form:password path="password" cssClass="title required" id="password"/></p>
	<p><label>Re password</label><br/><input type="password" class="title required" id="repassword" equalto="#password"/></p>
	<hr/>
	<p><label>First Name</label><br/><form:input path="firstName" cssClass="title required" id="firstName"/></p>
	<p><label>Last Name</label><br/><form:input path="lastName" cssClass="title required" id="firstName"/></p>
	<p>
	<button class="fg-button ui-state-default ui-corner-all" type="submit">Submit</button>
	<button class="fg-button ui-state-default ui-corner-all" type="reset">Reset</button>
	</p>
</form:form>
</fieldset>
</div>
